home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- * QTAKE-D.H version 2.0
- *
- * Copyright Apple Computer, Inc. 1993 -1995, All Rights Reserved.
- * Portions (c) 1994, 1995 Eastman Kodak Company.
- *******************************************************************************/
-
- #ifndef _INC_QTAKE_D
- #define _INC_QTAKE_D
-
- #define FarPointer far*
-
- /* Windows must be this version or later in order for
- * us to be able to support asynchronous operations.
- */
- #define WINVER_AS_MAJOR 3
- #define WINVER_AS_MINOR 1
-
- /* The manufacturerID field of CmPortInfo must be the following.
- * Otherwise Connect will refuse with kCmBadArgError.
- */
- #define kCmManufacturerID100 0x0101 // For Venus
- #define kCmManufacturerID150 0x00c8 // For Nimbus
-
- /* These types must be defined for the user application as well.
- */
- typedef short OSErr; /* Type of data item all Cm functions return. Follows Mac convention */
- typedef unsigned short CameraData; /* First argument to all the Cm functions. Must be application instance handle.
- * WARNING: Should probably say HANDLE instead of u_short. Might lose portability this way */
- typedef unsigned short far* CameraDataPtr;
-
- /* These must be here so the original structure definitions looks AOK */
- typedef unsigned char far* Handle;
- typedef unsigned char far* StringHandle;
- typedef int Boolean;
- typedef unsigned char far* BufferPtr;
- typedef short far* shortPtr;
- typedef long far* LongPtr;
-
- /* The global constants.
- */
- #define kCmMAXPICTNO 4096 /* Max number of pictures a QuickTake camera can store */
- #define kCmMAXIDWIDTH 32 /* Number of bytes for camera owner name */
-
- /* Picture modes, i.e., image sizes. See CmSetPictureMode */
- #define kCmHiRes 16
- #define kCmLoRes 32
-
- /* Flash modes of the camera. Used in subsequent picture taking */
- #define kCmFlashAuto 0 /* Camera decides whether to use flash */
- #define kCmFlashOff 1 /* Camera does not use flash */
- #define kCmFlashOn 2 /* Camera always uses flash */
-
- /* Size of a Decompression Table. See CmGetDecompTable */
-
- #define kCmDecompTableSize100 98
- #define kCmDecompTableSize150 174 // This size is for Nimbus Camera
-
- #define kProductID100i 0x0101 // Intel memory in Venus
- #define kProductID100t 0x0100 // Toshiba memory in Venus
- #define kProductID150 0x0001 // For Nimbus
-
- /* Constants defined for CmSetSleep.
- * IT'S IMPORTANT VALUES BE SANDWICHED BETWEEN kCmSleepNow and kCmSleepNever */
- #define kCmSleepNow 0 /* Camera hibernates immediately */
- #define kCmSleep5M 1 /* Camera hibernates after 5 minutes if no command from host. Default */
- #define kCmSleep15M 2 /* Camera hibernates after 15 minutes if no command from host */
- #define kCmSleep30M 3 /* Camera hibernates after 30 minutes if no command from host */
- #define kCmSleep60M 4 /* Camera hibernates after 60 minutes if no command from host */
- #define kCmSleepNever 5 /* Tells Camera never to sleep */
-
- /* Constants defined for the batteryStatus member of CmCameraInfo */
- #define kPowerAdapter 140 /* Power adapter is being used if >= this value */
- #define kBatteryIconFull 86 /* Battery can be said to be full if >= this value */
- #define kBatteryIconHalf 80 /* Battery should be said to be half full if below IconFUll and >= this value */
- #define kBatteryRangeFull 95 /* Battery full */
- #define kBatteryRangeEmpty 75 /* Battery empty */
-
- /* The error values returned by the Cm functions.
- */
- #define noErr 0 /* Everything's AOK */
- #define kCmAlreadyOpenError 1 /* Library already open */
- #define kCmNotOpenError 2 /* Library not open yet */
- #define kCmBadArgError 3 /* One of the argument is, points to or contains a pointer to, an illegal value */
- #define kCmNotConnectedError 4 /* Application does not have connection to camera */
- #define kCmCurrentlyConnectedError 5 /* Application is already connected to an instance of camera */
- #define kCmNoMemoryError 6 /* Failed to get memory */
- #define kCmNoSuchPortError 7 /* No port corresponding to the given index */
- #define kCmCameraError 8 /* Error detected by the camera in context */
- #define kCmAIPError 9 /* An asynchronous operation is already in progress */
- #define kCmANIPError 10 /* No asynchronous operation outstanding */
- #define kCmCommError 11 /* Communication error */
- #define kCmCameraNotFoundError 12 /* Device connected to the port is not QuickTake. CmGetPortInfo or CmConnect */
- #define kCmHandshakeError 13 /* All baud rate negotiation failed. CmConnect */
- #define kCmProtocolError 14 /* Protocol error with QuickTake. All core functions */
- #define kCmSystemError 15 /* Windows system error */
- #define kCmANSError 16 /* This version of DLL does not support asynchronous operations */
- #define kCmCantCancel 17 /* Currently outstanding operation cannot be canceled. */
-
- /* The error values returned to CmGetErrorInfo after a Cm function reports
- * CmCameraError.
- * Two pieces of error codes are returned to each call of CmGetErrorInfo,
- * the first short representing the category of the error and the second one representing
- * the detailed information. on the error (I'm not too much enthusiastic about this implementation).
- */
- /* The error categories */
- #define kCmErNoError 0 /* I've been fine. Used also as detail information */
- #define kCmErNoBattery 1 /* Warning. Used also as detail information */
- #define kCmErMemoryFull 2 /* Warning: host has to free the camera memory. Used also as detail information */
- #define kCmErFlashNotReady 3 /* Warning. Used also as detail information */
- #define kCmErImageMemoryDefect 4 /* Image memory error recovered by a spare block. Used also as detail information */
- #define kCmErAttention 5 /* Info: command has been aborted */
- #define kCmErParityError 6 /* Parity or CRC error detected by the camera. Used also as detail information */
- #define kCmErTimeoutError 7 /* Host timeout. Perceived by the camera. Used also as detail information */
- #define kCmErHardwareError 8 /* Fatal error! */
- #define kCmErBadParameter 9 /* Protocol error, Fatal! */
- #define kCmErBadPictureNumber 10 /* No such picture */
- #define kCmErUnknownError 255 /* Undocumented error inside camera. Fatal! */
-
- /* Detail error information under kCmErAttention */
- #define kCmErCommandAborted 10 /* Image upload has been aborted by the host */
-
- /* Detail error information under kCmErHardwareError */
- #define kCmErGeneralHWError 11 /* Unknown hardware error */
- #define kCmErCPUError4Bit 12 /* Error detected within the 4-bit Processor */
- #define kCmErCPUError8Bit 13 /* Error detected within the 8-bit Processor */
- #define kCmErDSPError 14 /* Error detected within the DSP Processor */
- #define kCmErFrameMemoryError 15 /* Error inside the frame memory */
- #define kCmErTooManyImageMemoryDefects 16 /* No spare image block available at the time of error */
- #define kCmErImageMemoryError 17 /* Fatal error in the image memory */
-
- /* Detail error information under kCmErBadParameter */
- #define kCmErInvalidCmdCode 18 /* Unknown op code received from the host */
- #define kCmErInvalidControlCmd 19 /* Unknown control code received from the host */
- #define kCmErInvalidCmdData 20 /* Invalid entry in the Command Descriptor Block from the host */
- #define kCmErInvalidData 21 /* Invalid field in the parameter field from the host */
- #define kCmErNoData 22 /* No more data to send */
-
- /* Detail error information under kCmBadPictureNumber */
- #define kCmErBadPicNumImage 23 /* No image exists in the camera */
- #define kCmErBadPicNumInfo 24 /* No image information exists in the camera */
-
- /* Structure definitions.
- */
- #ifndef RC_INVOKED
- #pragma pack(1) /* Make sure structures are aligned on byte boundary. */
- #endif /* RC_INVOKED */ /* C++ by default packs classes on word boundary */
- /* The standard features of the driver retrieved via CmGetStdFeatures.
- * Came from Mac world but for Windows only version is meaningful. */
- typedef struct {
- short version; /* Version this DLL */
- } CmStdFeatures, FarPointer CmStdFeaturesPtr;
-
- /* Structure to identify the camera at the other end of a given communications
- * device.
- * See CmGetPortInfo, CmConnect and CmDisposePortInfo. */
- typedef struct {
- Handle portIcon; /* Internal use. Don't touch! */
- StringHandle portName; /* Operating specific name of the port. The string "COMn" */
- unsigned long portStatus; /* Status this port. See below */
- StringHandle appName; /* Name of the application using this port if port busy. NULL for Windows */
- unsigned short manufacturerID; /* 0 always */
- unsigned short productID; /* 0 always */
- Handle portConfig; /* Internal use. Don't touch! */
- unsigned long dataSpeed; /* Speed at which communication with camera takes place */
- } CmPortInfo, FarPointer CmPortInfoPtr, FarPointer FarPointer CmPortInfoHandle, FarPointer FarPointer FarPointer CmPortInfoHandlePtr;
-
- /* Valid bit values for portStatus field above. */
- #define kCmBitPortVENUS 1 /* Port has a QuickTake camera attached */
- #define kCmBitPortBusy 2 /* Port is being used by other application */
- #define kInUseByGeoPort (kCmBitPortVENUS|kCmBitPortBusy)
- /* Port used by another client of CmDriver. Added 10/21/93 */
- #define kPortFree kCmBitPortVENUS
- /* QuickTake is connected to this port and its idle */
-
- /* The product information.
- * Retrieved by CmGetProductInfo. */
- typedef struct {
- char vendorName[8]; /* Apple Computer */
- char productIdentification[16]; /* Apple Digital Camera */
- unsigned char hardwareVersion[2]; /* 1.01 - byte[1]=01, byte[0]=01 */
- unsigned char firmwareVersion[2]; /* 1.10 - byte[1]=01, byte[0]=10 */
- } CmProductInfo, FarPointer CmProductInfoPtr;
-
- /* Temporal information:
- * - time that the camera thinks it is (CmGetCameraInfo)
- * - time that a picture was taken (CmGetPictureInfo)
- * - time that hosts tells the camera to think it is (CmSetDateAndTime) */
- typedef struct {
- unsigned char month; /* 1 through 12 inclusive */
- unsigned char day; /* 1 through 31 inclusive */
- unsigned char year; /* Last two digits AD */
- unsigned char hour; /* 0 through 23 inclusive. Military. */
- unsigned char minute; /* 0 through 59 inclusive */
- unsigned char second; /* 0 through 59 inclusive */
- } CmDateAndTime, FarPointer CmDateAndTimePtr;
-
- /* Interface parameters with respect to the host computer */
- typedef struct {
- unsigned char transferRate; /* Baud Rate: 1200 times this value */
- unsigned char configuration; /* Parity, Stop bit and word length */
- unsigned char timeOut; /* What the camera thinks the houst ought to return within the period. 10 msecs times this value */
- } CmInterface, FarPointer CmInterfacePtr;
-
- /* The camera-wide info. returned via CmGetCameraInfo. */
- typedef struct {
- unsigned char batteryStatus; /* in % */
- unsigned short noPicturesTaken;
- unsigned short noPictureImageAvailable;
- unsigned short fullImageWidth; /* in pixels */
- unsigned short fullImageHeight; /* in pixels */
- unsigned short thumbnailImageWidth; /* in pixels */
- unsigned short thumbnailImageHeight; /* in pixels */
- CmDateAndTime cameraDateAndTime;
- unsigned char flashMode; /* 0 auto, 1 off, 2 on */
- unsigned short exposureTime; /* n in 1/n seconds */
- unsigned short FNumber; /* 10 (ten) times real F number. One of 28, 30, 35, 40, 49, 63, 90 or 160 */
- unsigned char pictureMode; /* 16 full-size coler, 32 quarter-size color */
- unsigned char reserved; /* Reserved */
- unsigned char fullImageDatCompMode; /* 1 ADPCM */
- unsigned char thumbImageDatCompMode; /* 3 bit shift (right 4 bits) */
- unsigned long totalMemorySize; /* in bytes */
- unsigned long freeMemorySize; /* in bytes */
- char ownerName[32];
- unsigned char CCDSensorType;
- CmInterface hostInterface; /* See above */
- unsigned char cameraInformationBytes[6]; /* Set at factory. Can't be modified */
- unsigned char compDecompParamVersion[4]; /* See CmGetDecompTable */
- unsigned char colorMatrixVersion[4]; /* See CmColorMatrix below */
- unsigned char spareImageMemoryBlock; /* # spare image blocks. Max 3 */
- unsigned short noBasePicturesTaken; /* # Base-size pictures taken */
- unsigned short noQuarterPicturesTaken; /* # Quater-size pictures taken */
- unsigned char sleepDelay; /* Sleep delay factor, in the range 0 and 5, inclusive */
- } CmCameraInfo, FarPointer CmCameraInfoPtr;
-
- /* The info. used to characterize a picture. Returned via CmGetPictureInfo */
- typedef struct {
- unsigned short pictureNo;
- unsigned long imageDataSize;
- unsigned short width;
- unsigned short height;
- CmDateAndTime dateAndTime;
- unsigned char flashMode;
- unsigned short exposureTime;
- unsigned short FNumber;
- unsigned char pictureMode; /* bit0=0 Full Size, bit0=1 1/4 size, bit4=0 B&W, bit4=1 Color */
- unsigned char dataCompressionMode; /* CFA=0, ADPCM=1, ColorDiff=2 */
- unsigned char defectiveFlag; /* If 1, this picture contains some defective blocks */
- } CmPictureInfo, FarPointer CmPictureInfoPtr;
-
- /* The color matrix pertaining to all pictures taken by a QuickTake
- * Returned via CmGetColorCorrectionMatrix. */
- typedef struct {
- unsigned char colorMatrixVersion[4];
- double colorCorrectionMatrix[12];
- } CmColorMatrix, FarPointer CmColorMatrixPtr;
-
- #ifndef RC_INVOKED
- #pragma pack()
- #endif /* RC_INVOKED */
-
- /* Cm Functions prototypes and global variables definitions.
- */
- /*----------------------------------------------------------------------------------------------*/
- typedef void (far pascal* CmAsyncCompletionRoutinePtr) (void);
- /*----------------------------------------------------------------------------------------------*/
- #ifdef __cplusplus
- extern "C" {
- #endif /* __cplusplus */
- /*----------------------------------------------------------------------------------------------*/
- /* Globals related to asynchronous callback routines */
- extern OSErr far gsAsyncStatus; /* Completion status this asynchronous operation */
- extern unsigned long far gulAsyncNBytes; /* Number of bytes transferred this async operation */
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmCancelAsyncOperation(CameraData);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmOpenDriver(CameraDataPtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmCloseDriver(CameraData);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetStdFeatures(CameraData,CmStdFeaturesPtr, short length);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetPortInfo(CameraData,unsigned long, CmPortInfoHandlePtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmDisposePortInfo(CameraData,CmPortInfoHandle);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmConnect(CameraData,CmPortInfoHandle);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmDisconnect(CameraData);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmCheckIfReady(CameraData);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmRestoreDefaults(CameraData);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetErrorInfo(CameraData,shortPtr,shortPtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetProductInfo(CameraData,CmProductInfoPtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmTakePicture(CameraData,Boolean);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmTakePictureAsync(CameraData,Boolean,CmAsyncCompletionRoutinePtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmSelfTest(CameraData);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetCameraInfo(CameraData,CmCameraInfoPtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetPictureInfo(CameraData,unsigned short,CmPictureInfoPtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetThumbnailImage(CameraData,unsigned short,BufferPtr,unsigned long,Boolean,LongPtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetThumbnailImageAsync(CameraData,unsigned short,BufferPtr,unsigned long,Boolean,CmAsyncCompletionRoutinePtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetFullSizeImage(CameraData,unsigned short,BufferPtr,unsigned long,Boolean,LongPtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetFullSizeImageAsync(CameraData,unsigned short,BufferPtr,unsigned long,Boolean,CmAsyncCompletionRoutinePtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmErase(CameraData);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmEraseAsync(CameraData,CmAsyncCompletionRoutinePtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmSetDateAndTime(CameraData,CmDateAndTimePtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmSetOwnerName(CameraData,BufferPtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmSetPictureMode(CameraData,unsigned char);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmSetFlashMode(CameraData,unsigned char);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetDecompTable(CameraData,BufferPtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmGetColorCorrectionMatrix(CameraData,CmColorMatrixPtr);
- /*----------------------------------------------------------------------------------------------*/
- extern OSErr far pascal CmSetSleep(CameraData,short sd);
- /*----------------------------------------------------------------------------------------------*/
- #ifdef __cplusplus
- };
- #endif /* __cplusplus */
- #endif /* _INC_QTAKE_D */
-